package cn.HuanG.pet.controller;

import cn.HuanG.org.service.IEmployeeService;
import cn.HuanG.pet.domain.SearchMasterMsg;
import cn.HuanG.pet.query.SearchMasterMsgQuery;
import cn.HuanG.pet.service.ISearchMasterMsgService;
import cn.HuanG.util.AjaxResult;
import cn.HuanG.util.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/searchMasterMsg")
public class SearchMasterMsgController {
    @Autowired
    private ISearchMasterMsgService seachMasterMsgService;

    @Autowired
    private IEmployeeService employeeService;

    /**
     * 宠物寻找主人  前台
     * @param searchMasterMsg
     * @param request
     * @return
     */
    @PostMapping("/publish")
    public AjaxResult publish(@RequestBody SearchMasterMsg searchMasterMsg, HttpServletRequest request){
        System.out.println("顶顶顶顶顶"+searchMasterMsg);
        //调用方法
        seachMasterMsgService.publish(searchMasterMsg,request);
        return AjaxResult.me();
    }

    /**
     * 查询数据所有数据  后台代码
     * @param query
     * @param request
     * @return
     */
    @PostMapping("/pending")
    public PageInfo<SearchMasterMsg> pending(@RequestBody SearchMasterMsgQuery query, HttpServletRequest request){
        PageInfo<SearchMasterMsg> queryPage = seachMasterMsgService.queryPage(query,request);
        System.out.println("啊哈哈哈"+queryPage);
        return queryPage;
    }

}
